
libname web 'C:\primary\DataWeb\RESEARCH.Studies\Mathbalance\datastorage\';  *identify library where processed files will be stored;  

/*proc contents data = web.acafinal;run;*/

data temp; set web.acafinal;
  drop GIeb3 GIeb4 GIeb6 GIeb7 GIfb3 GIfb4 GIfb6 GIfb7 GImb3 GImb4 GImb6 GImb7
       MIeb3 MIeb4 MIeb6 MIeb7 MIfb3 MIfb4 MIfb6 MIfb7 MImb3 MImb4 MImb6 MImb7
       MAeb3 MAeb4 MAeb6 MAeb7 MAfb3 MAfb4 MAfb6 MAfb7 MAmb3 MAmb4 MAmb6 MAmb7
       MXeb3 MXeb4 MXeb6 MXeb7 MXfb3 MXfb4 MXfb6 MXfb7 MXmb3 MXmb4 MXmb6 MXmb7
       MSeb3 MSeb4 MSeb6 MSeb7 MSfb3 MSfb4 MSfb6 MSfb7 MSmb3 MSmb4 MSmb6 MSmb7
       IPADDRES i study_name exp imp;

  if Imathatt = . and Imathid = . and Imathanx = . and Imathstro = . and Igenid = . and
     zipcode = "" and workyears = . and stro1 = . and stro2 = . and skill1 = . and skill2 = . and
	 part1 = . and part2 = . and part3 = . and nation = "" and mid1 = . and mid2 = . and mid3 = . and
	 education = . and eth = . and gender = "" and ages = . and
     Egenid = . and Emathanx = . and Emathatt = . and Emathid  = . and
     Emathstro = . and Earts = . and Efurniture = . and Elanguage = . and Emath = .
  then delete; *empty cells;

  * participants with very suspicious data - age/workyears, or age/gradschool, or similar discrepancies;
  if session_id in (44211, 31046, 21698, 26232, 31758, 25879, 39033, 22314, 45787) then delete;

/*proc means n mean std;run;*/
*total sessions = 10697;
*demographics at end, almost 5000 sessions are not usable;

data temp; set temp;
   if gender in ("", ".") then delete; *demographics came at the end, cannot do any of the
                                        main analyses without gender information;
   Tmathversus = Emath - mean(Earts, Efurniture, Elanguage);

   *comparison conditions;
   if anxtask_name in ("Amathanxa", "Amathanxb") or atttask_name in ("Amathatta", "Amathattb")
      or idtask_name in ("Amathida","Amathidb") or strotask_name in ("Amathstroa", "Amathstrob")
   then Ccond = "A";
   else if anxtask_name in ("Vmathanxa", "Vmathanxb") or atttask_name in ("Vmathatta", "Vmathattb")
      or idtask_name in ("Vmathida","Vmathidb") or strotask_name in ("Vmathstroa", "Vmathstrob")
   then Ccond = "V";
   else if anxtask_name in ("Fmathanxa", "Fmathanxb") or atttask_name in ("Fmathatta", "Fmathattb")
      or idtask_name in ("Fmathida","Fmathidb") or strotask_name in ("Fmathstroa", "Fmathstrob")
   then Ccond = "F";

   if maj = "Science" or maj2 = "Science" then major = "Science";
   else if maj = "Human" or maj2 = "Human" then major = "Human";
   else if maj in ("", ".") and maj2 in ("", ".") then major = ".";
   else if maj = "other" or maj2 = "other" then major = "Other";
   else major = "else?";

   mid2 = 5-mid2; stro2 = 5-stro2; gid1 = 5-gid1;
   Imathatt=0-Imathatt; Imathanx=0-Imathanx; 
   Emathanx = 0-Emathanx; Egenid = 0- Egenid;
   *fix coding of variables;

/*proc corr; var Imathatt Imathid Imathanx Imathstro Igenid;
           with Emathatt Emathid Emathanx Emathstro Egenid;run;*/


TITLE 'DATA = academic attitudes';
ODS HTML BODY = 'C:\primary\DataWeb\RESEARCH.Studies\Mathbalance\datastorage\AA.01.summarycontentsmeans.html';
proc contents;run;
proc means; run;
* total sessions = 5139;
* only counts people who made it all the way through and filled out gender
  bc demographics was at the end;
ODS HTML CLOSE;

TITLE 'DATA = academic attitudes';
ODS HTML BODY = 'C:\primary\DataWeb\RESEARCH.Studies\Mathbalance\datastorage\AA.02.creationDateMonYr.html';
  proc freq; format creation_date dtmonyy5.;tables creation_date;run;
ODS HTML CLOSE;

/* demographics of sample */
TITLE 'DATA = academic attitudes';
ODS HTML BODY = 'C:\primary\DataWeb\RESEARCH.Studies\Mathbalance\datastorage\AA.03.demographics.html';
proc means; class gender; var session_id;run;
proc means; class eth; var session_id;run;
proc means; class education; var session_id;run;
proc means; class major; var session_id;run;
proc means; class gmaj; var session_id;run;
proc means; var ages GRDyear workyears SATmath SATverbal ACTmath ACTscience ACTeng ACTread; run;
proc means; class nation; var session_id;run;
ODS HTML CLOSE;


/* comparing Verbal, Arts, and Furniture conditions - can we combine them? */
TITLE 'DATA = academic attitudes';
ODS HTML BODY = 'C:\primary\DataWeb\RESEARCH.Studies\Mathbalance\datastorage\AA.04.AFVconditioncomparisons.html';
proc means; class Ccond; var Imathatt Imathid Imathanx Imathstro Igenid;run;
proc means; class Ccond gender; var Imathatt Imathid Imathanx Imathstro Igenid;run;
proc sort; by Ccond;
proc corr; by Ccond; var Imathatt Imathid Imathanx Imathstro Igenid;run;
proc sort; by Ccond gender;
proc corr; by Ccond gender; var Imathatt Imathid Imathanx Imathstro Igenid;run;
proc corr; by Ccond gender; var Imathatt Imathid Imathanx Imathstro Igenid;
           with Emathatt Emathid Emathanx Emathstro Egenid Emath Earts Efurniture Elanguage; run;
*conclusion, some influence on mean effects but fairly similar external validity;
*include condition as a covariate in regression analyses;
ODS HTML CLOSE;

*is it justified to combine individual items?;
TITLE 'DATA = academic attitudes';
ODS HTML BODY = 'C:\primary\DataWeb\RESEARCH.Studies\Mathbalance\datastorage\AA.05.combiningexplicititems.html';
proc corr; var anx1 anx2 mid1 mid2 mid3 part1 part2 part3;run;
proc corr; var gid1 gid2 skill1 skill2 stro1 stro2;run;
proc sort; by gender; proc corr; by gender; var gid1 gid2;run;

proc corr alpha; var anx1 anx2; 
proc corr alpha; var mid1 mid2 mid3;
proc corr alpha; var part1 part2 part3;
proc corr alpha; var gid1 gid2;
proc corr alpha; var skill1 skill2;
proc corr alpha; var stro1 stro2;run;
ODS HTML CLOSE;

data temp; set temp;
  EXPanx = mean(anx1, anx2);
  EXPmid = mean(mid1, mid3, mid2);
  EXPpart = mean(part1, part2, part3);
  EXPgid = mean(gid1, gid2); 
  EXPskill = mean(skill1, skill2);
  EXPstro = mean(stro1, stro2);

  SATdiff = SATmath - SATverbal;
  ACTdiff = ACTmath - ACTeng;

  EXPmid=5-EXPmid; EXPskill=5-EXPskill; EXPpart = 5-EXPpart; EXPstro= 5-EXPstro;

  if education in (4,5) then edu = 1;
  else if education in (6) then edu = 2;
  else if education in (7,8,9) then edu = 3;
  else edu = 0;

  if gmaj = "Science" then do; grad=1; sci=1; Sgroup = 2;end;
  else if maj = "Science" then do; grad=0; sci=1; Sgroup = 1;end;
  else if gmaj NE "." then do; grad=1; sci=0; Sgroup = 0;end;
  else if maj NE "." then do; grad=0; sci=0; Sgroup = 0;end;

  Imathpos = mean(Imathatt, Imathid, Imathanx);

  if Ccond = "A" then do; Ccond1 = -1; Ccond2 = -1;end;
  else if Ccond = "V" then do; Ccond1 = 1; Ccond2 = -1;end;
  else if Ccond = "F" then do; Ccond1 = -1; Ccond2 = 1;end;

  if gender = "f" then sex = 1; else if gender = "m" then sex = -1;


/* simple gender differences in implicit, explicit, and performance variables */
TITLE 'DATA = academic attitudes';
ODS HTML BODY = 'C:\primary\DataWeb\RESEARCH.Studies\Mathbalance\datastorage\AA.06.simplegendercomparisons.html';
proc means; class gender; var Imathatt Imathid Imathanx Imathstro Igenid;run;
proc glm; class Ccond gender; model Imathatt = gender|Ccond;run;
proc glm; class Ccond gender; model Imathid = gender|Ccond;run;
proc glm; class Ccond gender; model Imathanx = gender|Ccond;run;
proc glm; class Ccond gender; model Imathstro = gender|Ccond;run;
proc glm; class Ccond gender; model Igenid = gender|Ccond;run;

proc means; class gender; var Emathatt Emathid Emathanx Emathstro Egenid;run;
proc glm; class Ccond gender; model Emathatt = gender|Ccond;run;
proc glm; class Ccond gender; model Emathid = gender|Ccond;run;
proc glm; class Ccond gender; model Emathanx = gender|Ccond;run;
proc glm; class Ccond gender; model Emathstro = gender|Ccond;run;
proc glm; class Ccond gender; model Egenid = gender|Ccond;run;

proc means; class gender; var EXPmid EXPanx EXPpart EXPskill EXPstro EXPgid;run;
proc glm; class Ccond gender; model EXPmid = gender|Ccond;run;
proc glm; class Ccond gender; model EXPanx = gender|Ccond;run;
proc glm; class Ccond gender; model EXPpart = gender|Ccond;run;
proc glm; class Ccond gender; model EXPskill = gender|Ccond;run;
proc glm; class Ccond gender; model EXPstro = gender|Ccond;run;
proc glm; class Ccond gender; model EXPgid = gender|Ccond;run;

proc means; class gender; var Tmathversus Emath Earts Elanguage Efurniture;run;
proc glm; class Ccond gender; model Tmathversus = gender|Ccond;run;
proc glm; class Ccond gender; model Emath = gender|Ccond;run;
proc glm; class Ccond gender; model Earts = gender|Ccond;run;
proc glm; class Ccond gender; model Elanguage = gender|Ccond;run;
proc glm; class Ccond gender; model Efurniture = gender|Ccond;run;

proc means; class gender; var SATdiff SATmath SATverbal ACTdiff ACTmath ACTeng ACTread ACTscience;run;
proc glm; class Ccond gender; model SATdiff = gender|Ccond;run;
proc glm; class Ccond gender; model SATmath = gender|Ccond;run;
proc glm; class Ccond gender; model SATverbal = gender|Ccond;run;
proc glm; class Ccond gender; model ACTdiff = gender|Ccond;run;
proc glm; class Ccond gender; model ACTmath = gender|Ccond;run;
proc glm; class Ccond gender; model ACTeng = gender|Ccond;run;
proc glm; class Ccond gender; model ACTread = gender|Ccond;run;
proc glm; class Ccond gender; model ACTscience = gender|Ccond;run;
ODS HTML CLOSE;

proc sort; by gender;
TITLE 'DATA = academic attitudes';
ODS HTML BODY = 'C:\primary\DataWeb\RESEARCH.Studies\Mathbalance\datastorage\AA.07.correlationsbygender.html';
proc corr; by gender; var Imathatt Imathid Imathanx Imathstro Igenid; run;
proc corr; by gender; var Emathatt Emathid Emathanx Emathstro Egenid; run;
proc corr; by gender; var EXPanx EXPmid EXPpart EXPskill EXPstro EXPgid;run;
proc corr; by gender; var Tmathversus Emath Earts Elanguage Efurniture;run;
proc corr; by gender; var SATdiff SATmath SATverbal ACTdiff ACTmath ACTeng ACTread ACTscience;run;

proc corr; by gender; var Imathatt Imathid Imathanx Imathstro Igenid;
           with Emathatt Emathid Emathanx Emathstro Egenid; run;
proc corr; by gender; var Imathatt Imathid Imathanx Imathstro Igenid;
           with EXPanx EXPmid EXPpart EXPskill EXPstro EXPgid;  run;
proc corr; by gender; var Imathatt Imathid Imathanx Imathstro Igenid;
           with Tmathversus Emath Earts Elanguage Efurniture;  run;
proc corr; by gender; var Imathatt Imathid Imathanx Imathstro Igenid;
           with SATdiff SATmath SATverbal ACTdiff ACTmath ACTeng ACTread ACTscience;  run;

proc corr; by gender; var Imathpos Imathstro Igenid;
           with Emathatt Emathid Emathanx Emathstro Egenid;  run;
proc corr; by gender; var Imathpos Imathstro Igenid;
           with EXPanx EXPmid EXPpart EXPskill EXPstro EXPgid;  run;
proc corr; by gender; var Imathpos Imathstro Igenid;
           with Tmathversus Emath Earts Elanguage Efurniture;  run;
proc corr; by gender; var Imathpos Imathstro Igenid;
           with SATdiff SATmath SATverbal ACTdiff ACTmath ACTeng ACTread ACTscience;  run;

proc corr; by gender; var Emathatt Emathid Emathanx Emathstro Egenid;
           with EXPanx EXPmid EXPpart EXPskill EXPstro EXPgid;  run;
proc corr; by gender; var Emathatt Emathid Emathanx Emathstro Egenid;
           with Tmathversus Emath Earts Elanguage Efurniture;  run;
proc corr; by gender; var Emathatt Emathid Emathanx Emathstro Egenid;
           with SATdiff SATmath SATverbal ACTdiff ACTmath ACTeng ACTread ACTscience; run;

proc corr; by gender; var EXPanx EXPmid EXPpart EXPskill EXPstro EXPgid;
           with Tmathversus Emath Earts Elanguage Efurniture;run;
proc corr; by gender; var EXPanx EXPmid EXPpart EXPskill EXPstro EXPgid;
           with SATdiff SATmath SATverbal ACTdiff ACTmath ACTeng ACTread ACTscience;run;

proc corr; by gender; var Tmathversus Emath Earts Elanguage Efurniture;
           with SATdiff SATmath SATverbal ACTdiff ACTmath ACTeng ACTread ACTscience;run;
ODS HTML CLOSE;



TITLE 'DATA = academic attitudes';
ODS HTML BODY = 'C:\primary\DataWeb\RESEARCH.Studies\Mathbalance\datastorage\AA.08.basicgroupdifferences.html';
proc glm; class gender eth; model Imathatt = gender eth education ages;run;
proc glm; class gender eth; model Imathid = gender eth education ages;run;
proc glm; class gender eth; model Imathanx = gender eth education ages;run;
proc glm; class gender eth; model Imathstro = gender eth education ages;run;
proc glm; class gender eth; model Igenid = gender eth education ages;run;

proc glm; class gender eth; model Emathatt = gender eth education ages;run;
proc glm; class gender eth; model Emathid = gender eth education ages;run;
proc glm; class gender eth; model Emathanx = gender eth education ages;run;
proc glm; class gender eth; model Emathstro = gender eth education ages;run;
proc glm; class gender eth; model Egenid = gender eth education ages;run;
ODS HTML CLOSE;

data temp; set temp;
  *prep for regression analyses;
  *centering variables without a rational zero;
  /*EXPanx = EXPanx-2.5443985; 
  EXPmid = EXPmid-2.32992;
  EXPpart= EXPpart-2.79250;
  EXPgid = EXPgid-2.3215412; 
  EXPskill = EXPskill-2.47461;*/
  EXPstro = EXPstro - 1.76512; 
  *cImathstro = Imathstro-0.2506161;

  sxc1 = sex*Ccond1; sxc2 = sex*Ccond2; gpc1 = sgroup*Ccond1; gpc2 = sgroup*Ccond2; sxgp = sgroup*sex;
  sxIst = sex*Imathstro; sxEst = sex*Emathstro;  sxEst2 = sex*EXPstro;
  Istc1 = Ccond1*Imathstro; Istc2 = Ccond2*Imathstro; 
  Estc1 = Ccond1*Emathstro; Estc2 = Ccond2*Emathstro; 
  Est2c1 = Ccond1*EXPstro; Est2c2 = Ccond2*EXPstro; 

  /*CCsxIst = sex*cImathstro; CCIstc1 = Ccond1*cImathstro; CCIstc2 = Ccond2*cImathstro; */


TITLE 'DATA = academic attitudes';
ODS HTML BODY = 'C:\primary\DataWeb\RESEARCH.Studies\Mathbalance\datastorage\AA.09.majordifferences.html';
proc means n mean std; class gender Sgroup; var Imathpos;run;
proc glm; class gender Ccond; model Imathpos = Ccond gender Sgroup 
                                    Ccond*gender Ccond*Sgroup gender*Sgroup;run;
proc reg; model Imathpos = Ccond1 Ccond2 sex Sgroup /stb;
     model Imathpos = Ccond1 Ccond2 sex Sgroup sxc1 sxc2 gpc1 gpc2 sxgp /stb;run;

proc ttest; class gender; var Imathpos; where Sgroup = 0;run;
proc ttest; class gender; var Imathpos; where Sgroup = 1;run;
proc ttest; class gender; var Imathpos; where Sgroup = 2;run;

proc means n mean std; class gender Sgroup; var Imathstro;run;
proc glm; class gender Ccond; model Imathstro = Ccond gender Sgroup 
                                    Ccond*gender Ccond*Sgroup gender*Sgroup;run;
proc reg; model Imathstro = Ccond1 Ccond2 sex Sgroup /stb;
     model Imathstro = Ccond1 Ccond2 sex Sgroup sxc1 sxc2 gpc1 gpc2 sxgp /stb;run;
proc ttest; class gender; var Imathstro; where Sgroup = 0;run;
proc ttest; class gender; var Imathstro; where Sgroup = 1;run;
proc ttest; class gender; var Imathstro; where Sgroup = 2;run;


proc means n mean std; class gender Sgroup; var Imathatt;run;
proc glm; class gender Ccond; model Imathatt = Ccond gender Sgroup 
                                    Ccond*gender Ccond*Sgroup gender*Sgroup;run;
proc means n mean std; class gender Sgroup; var Imathid;run;
proc glm; class gender Ccond; model Imathid = Ccond gender Sgroup 
                                    Ccond*gender Ccond*Sgroup gender*Sgroup;run;
proc means n mean std; class gender Sgroup; var Imathanx;run;
proc glm; class gender Ccond; model Imathanx = Ccond gender Sgroup 
                                    Ccond*gender Ccond*Sgroup gender*Sgroup;run;
proc means n mean std; class gender Sgroup; var Igenid;run;
proc glm; class gender; model Igenid = gender|Sgroup;run;

ODS HTML CLOSE;

*Replacement analyses for MAJOR part of Nosek & Smyth article - making major a categorical variable;
proc glm; class gender Sgroup Ccond; model Imathpos = Ccond gender Sgroup 
                                    Ccond*gender Ccond*Sgroup gender*Sgroup;run;
proc glm; class gender Sgroup Ccond; model Imathstro = Ccond gender Sgroup 
                                    Ccond*gender Ccond*Sgroup gender*Sgroup;run;

/*
proc glm; class Ccond sex;
          model Emathatt = Ccond sex Imathstro Emathstro;run;
proc glm; class Ccond sex;
          model Emathatt = Ccond sex Imathstro Emathstro
                           Ccond*sex Ccond*Imathstro Ccond*Emathstro
                           sex*Imathstro sex*Emathstro;run;

*comparing centered, only changes beta, b and sig tests same;
proc reg; model Emathatt = Ccond1 Ccond2 sex cImathstro Emathstro /stb;
          model Emathatt = Ccond1 Ccond2 sex sxc1 sxc2 cImathstro CCsxIst CCIstc1 CCIstc2
                           Emathstro sxEst Estc1 Estc2 /stb;run;*/



TITLE 'DATA = academic attitudes';
ODS HTML BODY = 'C:\primary\DataWeb\RESEARCH.Studies\Mathbalance\datastorage\AA.10.predvalidity.html';
proc corr; var Imathstro Emathstro EXPstro;run;

proc reg; model Emathatt = sex Ccond1 Ccond2 sxc1 sxc2 Emathstro sxEst Estc1 Estc2 /stb;
          model Emathatt = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           Emathstro sxEst Estc1 Estc2 /stb;run;
proc reg; model Emathid = sex Ccond1 Ccond2 sxc1 sxc2 Emathstro sxEst Estc1 Estc2 /stb;
          model Emathid = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           Emathstro sxEst Estc1 Estc2 /stb;run;
proc reg; model Emathanx = sex Ccond1 Ccond2 sxc1 sxc2 Emathstro sxEst Estc1 Estc2 /stb;
          model Emathanx = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           Emathstro sxEst Estc1 Estc2 /stb;run;
proc reg; model EXPanx = sex Ccond1 Ccond2 sxc1 sxc2 Emathstro sxEst Estc1 Estc2 /stb;
          model EXPanx = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           Emathstro sxEst Estc1 Estc2 /stb;run;
proc reg; model EXPmid = sex Ccond1 Ccond2 sxc1 sxc2 Emathstro sxEst Estc1 Estc2 /stb;
          model EXPmid = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           Emathstro sxEst Estc1 Estc2 /stb;run;
proc reg; model EXPpart = sex Ccond1 Ccond2 sxc1 sxc2 Emathstro sxEst Estc1 Estc2 /stb;
          model EXPpart = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           Emathstro sxEst Estc1 Estc2 /stb;run;
proc reg; model EXPskill = sex Ccond1 Ccond2 sxc1 sxc2 Emathstro sxEst Estc1 Estc2 /stb;
          model EXPskill = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           Emathstro sxEst Estc1 Estc2 /stb;run;
proc reg; model Tmathversus = sex Ccond1 Ccond2 sxc1 sxc2 Emathstro sxEst Estc1 Estc2 /stb;
          model Tmathversus = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           Emathstro sxEst Estc1 Estc2 /stb;run;
proc reg; model Emath = sex Ccond1 Ccond2 sxc1 sxc2 Emathstro sxEst Estc1 Estc2 /stb;
          model Emath = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           Emathstro sxEst Estc1 Estc2 /stb;run;
proc reg; model SATdiff = sex Ccond1 Ccond2 sxc1 sxc2 Emathstro sxEst Estc1 Estc2 /stb;
          model SATdiff = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           Emathstro sxEst Estc1 Estc2 /stb;run;
proc reg; model SATmath = sex Ccond1 Ccond2 sxc1 sxc2 Emathstro sxEst Estc1 Estc2 /stb;
          model SATmath = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           Emathstro sxEst Estc1 Estc2 /stb;run;
proc reg; model SATverbal = sex Ccond1 Ccond2 sxc1 sxc2 Emathstro sxEst Estc1 Estc2 /stb;
          model SATverbal = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           Emathstro sxEst Estc1 Estc2 /stb;run;
proc reg; model ACTdiff = sex Ccond1 Ccond2 sxc1 sxc2 Emathstro sxEst Estc1 Estc2 /stb;
          model ACTdiff = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           Emathstro sxEst Estc1 Estc2 /stb;run;
proc reg; model ACTmath = sex Ccond1 Ccond2 sxc1 sxc2 Emathstro sxEst Estc1 Estc2 /stb;
          model ACTmath = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           Emathstro sxEst Estc1 Estc2 /stb;run;
proc reg; model ACTeng = sex Ccond1 Ccond2 sxc1 sxc2 Emathstro sxEst Estc1 Estc2 /stb;
          model ACTeng = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           Emathstro sxEst Estc1 Estc2 /stb;run;
proc reg; model ACTread = sex Ccond1 Ccond2 sxc1 sxc2 Emathstro sxEst Estc1 Estc2 /stb;
          model ACTread = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           Emathstro sxEst Estc1 Estc2 /stb;run;
proc reg; model ACTscience = sex Ccond1 Ccond2 sxc1 sxc2 Emathstro sxEst Estc1 Estc2 /stb;
          model ACTscience = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           Emathstro sxEst Estc1 Estc2 /stb;run;

* same analyses with other explicit stereotyping measure;
proc reg; model Emathatt = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model Emathatt = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;run;
proc reg; model Emathid = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model Emathid = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;run;
proc reg; model Emathanx = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model Emathanx = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;run;
proc reg; model EXPanx = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model EXPanx = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;run;
proc reg; model EXPmid = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model EXPmid = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;run;
proc reg; model EXPpart = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model EXPpart = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;run;
proc reg; model EXPskill = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model EXPskill = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;run;
proc reg; model Tmathversus = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model Tmathversus = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;run;
proc reg; model Emath = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model Emath = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;run;
proc reg; model SATdiff = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model SATdiff = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;run;
proc reg; model SATmath = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model SATmath = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;run;
proc reg; model SATverbal = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model SATverbal = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;run;
proc reg; model ACTdiff = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model ACTdiff = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;run;
proc reg; model ACTmath = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model ACTmath = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;run;
proc reg; model ACTeng = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model ACTeng = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;run;
proc reg; model ACTread = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model ACTread = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;run;
proc reg; model ACTscience = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model ACTscience = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;run;
ODS HTML CLOSE;

TITLE 'DATA = academic attitudes';
ODS HTML BODY = 'C:\primary\DataWeb\RESEARCH.Studies\Mathbalance\datastorage\AA.11.predvaliditymalefemaleseparate.html';
proc reg; model Emathatt = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = -1; run;
proc reg; model Emathatt = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = 1; run;
proc reg; model Emathid = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = -1; run;
proc reg; model Emathid = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = 1; run;
proc reg; model Emathanx = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = -1; run;
proc reg; model Emathanx = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = 1; run;
proc reg; model EXPanx = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = -1; run;
proc reg; model EXPanx = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = 1; run;
proc reg; model EXPmid = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = -1; run;
proc reg; model EXPmid = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = 1; run;
proc reg; model EXPpart = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = -1; run;
proc reg; model EXPpart = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = 1; run;
proc reg; model EXPskill = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = -1; run;
proc reg; model EXPskill = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = 1; run;
proc reg; model Tmathversus = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = -1; run;
proc reg; model Tmathversus = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = 1; run;
proc reg; model Emath = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = -1; run;
proc reg; model Emath = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = 1; run;
proc reg; model SATdiff = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = -1; run;
proc reg; model SATdiff = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = 1; run;
proc reg; model SATmath = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = -1; run;
proc reg; model SATmath = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = 1; run;
proc reg; model SATverbal = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = -1; run;
proc reg; model SATverbal = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = 1; run;
proc reg; model ACTdiff = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = -1; run;
proc reg; model ACTdiff = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = 1; run;
proc reg; model ACTmath = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = -1; run;
proc reg; model ACTmath = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = 1; run;
proc reg; model ACTeng = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = -1; run;
proc reg; model ACTeng = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = 1; run;
proc reg; model ACTread = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = -1; run;
proc reg; model ACTread = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = 1; run;
proc reg; model ACTscience = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = -1; run;
proc reg; model ACTscience = Ccond1 Ccond2 Imathstro Istc1 Istc2
                           Emathstro Estc1 Estc2 /stb; where sex = 1; run;
ODS HTML CLOSE;



*testing mediated moderation;
proc reg; model EXPpart = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model EXPpart = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model EXPpart = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 Imathpos /stb;
          model EXPpart = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 Imathpos Emathatt /stb;run;
proc reg; model EXPskill = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model EXPskill = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model EXPskill = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 Imathpos /stb;
          model EXPskill = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 Imathpos Emathatt /stb;run;
proc reg; model SATdiff = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model SATdiff = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;          
          model SATdiff = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 Imathpos /stb;
          model SATdiff = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 Imathpos Emathatt /stb;run;
proc reg; model ACTdiff = sex Ccond1 Ccond2 sxc1 sxc2 EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model ACTdiff = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 /stb;
          model ACTdiff = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 Imathpos /stb;
          model ACTdiff = Ccond1 Ccond2 sex sxc1 sxc2 Imathstro sxIst Istc1 Istc2
                           EXPstro sxEst2 Est2c1 Est2c2 Imathpos Emathatt /stb;run;

























proc reg; model Emathatt = Ccond1 Ccond2 sex Imathstro Emathstro /stb;
          model Emathatt = Ccond1 Ccond2 sex Imathstro Emathstro 
                Istc1 Istc2 Estc1 Estc2 sxc1 sxc2 sxIst sxEst /stb;run;
proc reg; model Emathid = Ccond1 Ccond2 sex Imathstro Emathstro /stb;
          model Emathid = Ccond1 Ccond2 sex Imathstro Emathstro 
                Istc1 Istc2 Estc1 Estc2 sxc1 sxc2 sxIst sxEst /stb;run;
proc reg; model Emathanx = Ccond1 Ccond2 sex Imathstro Emathstro /stb;
          model Emathanx = Ccond1 Ccond2 sex Imathstro Emathstro 
                Istc1 Istc2 Estc1 Estc2 sxc1 sxc2 sxIst sxEst /stb;run;
proc reg; model SATdiff = Ccond1 Ccond2 sex Imathstro Emathstro /stb;
          model SATdiff = Ccond1 Ccond2 sex Imathstro Emathstro 
                Istc1 Istc2 Estc1 Estc2 sxc1 sxc2 sxIst sxEst /stb;run;
proc reg; model ACTdiff = Ccond1 Ccond2 sex Imathstro Emathstro /stb;
          model ACTdiff = Ccond1 Ccond2 sex Imathstro Emathstro 
                Istc1 Istc2 Estc1 Estc2 sxc1 sxc2 sxIst sxEst /stb;run;


proc reg; model Emathatt = Ccond1 Ccond2 sex Imathstro EXPstro /stb;
          model Emathatt = Ccond1 Ccond2 sex Imathstro EXPstro 
                Istc1 Istc2 Est2c1 Est2c2 sxc1 sxc2 sxIst sxEst2 /stb;run;


proc glm; model Imathatt = Imathstro*Igenid; where gender='f' and Sgroup=0;run;
proc glm; model Imathatt = Imathstro|Igenid; where gender='f' and Sgroup=0;run;
proc glm; model Imathid = Imathstro*Igenid; where gender='f';run;
proc glm; model Imathid = Imathstro|Igenid; where gender='f';run;
proc glm; model Imathanx = Imathstro*Igenid; where gender='f';run;
proc glm; model Imathanx = Imathstro|Igenid; where gender='f';run;
proc glm; model Imathstro = Imathatt*Igenid; where gender='f';run;
proc glm; model Imathstro = Imathatt|Igenid; where gender='f';run;
proc glm; model Imathstro = Imathid*Igenid; where gender='f';run;
proc glm; model Imathstro = Imathid|Igenid; where gender='f';run;
proc glm; model Imathstro = Imathanx*Igenid; where gender='f';run;
proc glm; model Imathstro = Imathanx|Igenid; where gender='f';run;




proc means n mean std; class sci grad gender; var Imathid;run;
proc glm; class sci grad gender; model Imathid = grad|sci|gender;run;
proc glm; class sci grad gender; model Imathid = sci|gender;run;
proc glm; class sci grad gender; model Imathid = grad|gender;where sci=1;run;

proc means n mean std; class sci grad gender; var Imathanx;run;
proc glm; class sci grad gender; model Imathanx = grad|sci|gender;run;
proc glm; class sci grad gender; model Imathanx = grad|gender;where sci=1;run;

proc means n mean std; class sci grad gender; var Imathstro;run;
proc glm; class sci grad gender; model Imathstro = grad|sci|gender;run;
proc glm; class sci grad gender; model Imathstro = grad|gender;where sci=1;run;

proc means n mean std; class sci grad gender; var Igenid;run;
proc glm; class sci grad gender; model Igenid = grad|sci|gender;run;


proc means; class edu maj; var session_id;run;
proc means; class edu gmaj; var session_id;run;
proc means n mean std; class edu gmaj gender; var Imathatt;run;
proc means n mean std; class edu maj gender; var Imathatt;run;
proc means n mean std; class maj gmaj; var Imathatt;run;
proc means n mean std; class maj gmaj gender; var Imathatt;run;



proc means; class gender; var session_id;run;
proc means; class gender; var Imathatt Imathid Imathanx Imathstro Igenid;run;
proc means; class gender; var Emathatt Emathid Emathanx Emathstro Egenid;run;


proc means; class gender gmaj; var Imathatt Imathid Imathanx Imathstro Igenid;run;

proc means n mean std; class gender maj gmaj; var Imathstro;run;
proc means n mean std; class gender maj gmaj; var Imathatt;run;
proc means n mean std; class gender maj gmaj; var Imathid;run;

proc corr; var Imathatt Imathid Imathanx Imathstro Igenid;run;
proc sort; by gender;
proc corr; by gender; var Imathatt Imathid Imathanx Imathstro Igenid;run;
proc sort; by gender;
proc corr; by gender; var Emathatt Emathid Emathanx Emathstro Egenid;run;

proc univariate; by gender; var Egenid;run;

proc contents; run;

proc means; class study_name; var session_id;run;
